Costumecode::Application.routes.draw do


  devise_for :admins

  mount RailsAdmin::Engine => '/cp', :as => 'rails_admin'

  devise_for :users
  devise_scope :user do
    get "/logout" => "devise/sessions#destroy"
    get "/login" => "devise/sessions#new"
  end
 # devise_for :admins
 # devise_scope :admin do
 #   get "/logout" => "devise/sessions#destroy"
 #   get "/login" => "devise/sessions#new" 
 #  end

  #devise_for :users, :path=>"", :path_names => { :sign_in => 'login', :sign_out => 'logout', :password => 'secret', :confirmation => 'verification', :unlock => 'unblock', :registration => 'register', :sign_up => 'cmon_let_me_in' }

  #devise_scope :user do
  #  get "/logout" => "devise/sessions#destroy"
  #end

  get "site/index"
  
  get "/en" => 'site#en'
  get '/landing' => 'site#index', defaults: {landing: true}

 
#Routes for site pages



  match '/feedback', :controller => "feedback", :action =>"index", :via => [:get, :post]
  match '/admin/feedback', :controller => "admin", :action =>"feedback", :via => :get  
  match '/admin/feedback/delete/:id', :controller => "admin", :action =>"feedback_delete", :via => [:get]  
  
  #home page
  match '/admin', :controller => "admin", :action =>"home", :via => [:get, :put]
 
  match '/admin' => 'admin#index'


  #news
  match '/admin/news', :controller => "admin", :action =>"news", :via => :get  
  match '/admin/news/new', :controller => "admin", :action =>"news_new", :via => [:get, :post]
  match '/admin/news/edit/:id', :controller => "admin", :action =>"news_edit", :via => [:get, :put]
  match '/admin/news/delete/:id', :controller => "admin", :action =>"news_delete", :via => [:get]  

  #lookbook
  match '/admin/lookbook', :controller => "admin", :action =>"lookbook", :via => :get  
  match '/admin/lookbook/new', :controller => "admin", :action =>"lookbook_new", :via => [:get, :post]
  match '/admin/lookbook/edit/:id', :controller => "admin", :action =>"lookbook_edit", :via => [:get, :put]
  match '/admin/lookbook/delete/:id', :controller => "admin", :action =>"lookbook_delete", :via => [:get]

  #payments
  match '/'

  #certificates
  get "/certificate" => 'certificates#certificate'
  get "/certificate/virtual" => 'certificates#virtual'
  get "/certificate/real" => 'certificates#real'
  match '/certificate/new', :controller=> "certificates", :action => "create", :via =>[:post]
  match '/certificate/confirm', :controller => "certificates", :action=>"confirm", :via=>[:post]

  unless Rails.application.config.consider_all_requests_local
    match '*not_found', to: 'errors#error_404'
  end

  root :to => 'site#index'

end
